package com.bafa.util.comparators;


import com.bafa.objects.player.Player;
import com.bafa.objects.player.PlayerSeason;

import com.bafa.objects.player.PlayerDivision;
import com.bafa.services.RetrieveServices;

import java.io.Serializable;
import java.util.Comparator;


public class TopScorerComparator implements Comparator,Serializable {

        private int seasonId;
        private int divisionId;
	public int compare(Object scorer1, Object scorer2) {
		Player scorerA = RetrieveServices.getPlayer(""+scorer1);
		Player scorerB = RetrieveServices.getPlayer(""+scorer2);
		return ((PlayerSeason)scorerB.getSeasonGoals().get(seasonId)).getGoals()-((PlayerSeason)scorerA.getSeasonGoals().get(seasonId)).getGoals();
		
	}
        
        public TopScorerComparator setSeasonDivision(int seasonId,int divisionId){
            this.seasonId=seasonId;
            this.divisionId=divisionId;
            return this;
        }

}
